Victor Gan's profile

Mini traffic lights

In New Zealand, traffic lights are conformed to international standards in terms of color but due to the noted traffic numbers significantly smaller than a larger city, we have different phasing.
In Auckland, an average traffic switched over to the orange light for an average of 3.8seconds. In the UK, yellow lights are restricted by the speed limit at a ratio of 1 second for every 16 kilometers per hour. In New Zealand however our ratio increases the time for the same speed at 13.2 kilometers per hour per one second. Therefor the number of seconds a yellow light should stay on between green and red should be 0.07576 (rounded to 5 decimal places) times the speed limit of that road.
Living in Christchurch, I was always questioning my will to live upon approaching a certain intersection on the way to and from school. This traffic light had a very short duration on green and an extremely long wait time on red. Perhaps due to my direction of travel being opposite to the general flow of morning and evening traffic, I was always given a misfortunate hand of cards.
 
I would like to replicate this in a diorama to use to display some of my collection of my model cars while also reminding me of the trauma of letting god decide whether I was to be ten minutes late or eleven minutes late on that specific day.
 
Building the arduino circuit was pretty straight forward. Assembling my first model railway which included hundreds or individual LEDs and badly soldered joints had greatly prepared me for this moment.
Key notes to keep in mind were the LEDs and the horizontal numbered lane had to be kept consistent. Smaller details such as the positive and negative ends of LEDs and resistors also needed close attention to. Luckily this easy to use base board eliminated any need for soldering as the ends of the wires just needed to be plugged into the holes which was unfortunate as I was looking forward to seeing some of my classmates burn their fingers by accident. The final board I created looked like this.
Light testing required us to paste in an already written code and it was at this point I discovered that the positive and negatives were mixed up so none of the lights were working. Luckily after flipping them the circuit was functional.
The button test came with slightly more issues as the solder work on the positive and negative wires on the button was done rather poorly resulting in poor connection. Holding the wires together made the circuit work but using the board there was a break somewhere. I solved this by sticking the connecting wires into the same hole so they were guaranteed to be in contact.
Firstly the red light. From the time my car stopped to the time we were able to creep forward another couple centimeters was approximately half an average song and since most songs are three minutes long, half that is 90 seconds so 90,000 milliseconds. Let’s divide this value by 10 increasing speed by 10 times as fast. 9 seconds or 9000 milliseconds.
Secondly the green light was only on for a split second as it was a right turning light so I made it 2 seconds. 
The yellow light as mentioned at the beginning should be impacted by the speed limit. The speed limit of the road was 50kmph so the closest fully rounded whole number is three seconds.
Like human beings, traffic lights also have the ability to be broken. Where as a broken person may easily be identified in a pool of their own tears, a traffic light is still technically functional. You may notice that it flashes the orange light constantly on and off. I wrote the code for the broken traffic light next.
Finally, in for a penny in for a pound, I thought I might as well recreate the crossing bell lights when a train travels through a railroad crossing because trains are love and trains are life. To get the lights accurate I had to change the green led with another red one. However if I was to make both red LEDs named red, I would not be able to have them flash independently of each other so the second red LED was still under the green LED in code.
One thing I noticed was that at the end of the cycle, there was a slight delay before it repeated itself again. This is why the delay at the end of the cycle is half of what I wanted it to be as I worked out the delay was about 0.2 seconds.
Although for now, this is the conclusion of this current project, I can see potential for the use of electronic design especially in my hobby of model railways. While most lighting units built into a model railway layout are simple parallel circuits with constant power for things such as interior lighting for model buildings, with the ability of different phasing of lights turning off and on, more realistic portrayals of everyday life can be modeled such as operating traffic lights, buildings and street lights that turn on and off depending on day and night time and more.
Mini traffic lights
Published:

Mini traffic lights

Published: